<extend name="Layout:ly2"/>

<block name="head">
    <script type="text/javascript">
        $(function(){
            $("#btn-submit").click(function(){
                var userid = $("input[name='userid']").val();
                var password = $("input[name='password']").val();
                var repassword = $("input[name='repassword']").val();
                if (password == '') {
                    layer.msg('密码不能为空');
                    return false;
                }
                if (repassword == '') {
                    layer.msg('确认密码不能为空');
                    return false;
                }
                if(password != repassword){
                    layer.msg('两次密码输入不一致，请重新输入～');
                    return false;
                }

                $.get("{:U('Admin/Member/member_edit_pwd')}",{'action':'edit_pwd','userid':userid,'password':repassword},function(msg){
                    if(msg == 1){
                        layer.msg("修改成功，1秒后自动关闭~~",{ico:1,time:1000},function(){
                            parent.window.location.reload();    //刷新父页面
                        })
                    }else if(msg == 2){
                        layer.msg("参数异常，1秒后自动关闭~~",{ico:1,time:1000},function(){
                            parent.window.location.reload();    //刷新父页面
                        })
                    }else{
                        layer.msg("修改失败，1秒后自动关闭~~",{ico:1,time:1000},function(){
                            parent.window.location.reload();    //刷新父页面
                        })
                    }
                })
            })
        })
    </script>

</block>

<block name="body">
    <div class="container-fluid">
        <h3 id="title" align="center">修改密码</h3>
        <div class="padding20">
            <div class="form-horizontal p90">
                <input type="hidden" name="userid" value="{$data[0]['userid']}" />
                <div class="form-group">
                    <label class="col-sm-2 control-label">用户帐号：</label>
                    <div class="col-sm-8">
                        <input type="text" name="mobile" class="form-control" id="mobile" value="{$data[0]['mobile']}" readonly />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">新密码：</label>
                    <div class="col-sm-8">
                        <input type="password" name="password" class="form-control" id="password" placeholder="请输入新密码" value="" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">确认密码：</label>
                    <div class="col-sm-8">
                        <input type="password" name="repassword" class="form-control" id="repassword" placeholder="请输入确认密码" value="" />
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" id="btn-submit" class="btn btn-success">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
                        <button type="reset" class="btn btn-default">重置</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

</block>